<template>
  <div class="content-header">
    <div class="selectList">
      <el-form ref="form" :model="form" label-width="80px" @submit.native.prevent="searchingBtn"> 
        <div class="block">
          <el-date-picker class="time" v-model="form.searchTime"
           @change="searchingBtn" type="daterange" start-placeholder="开始日期"
            end-placeholder="结束日期" :clearable="false" 
           >
          </el-date-picker>
        </div>
        <div class="block search_con">
          <el-button type="primary">昼伏夜出时间</el-button>
          <el-time-picker class="time" v-model="form.searchTime"
           is-range
           @change="searchingBtn"  start-placeholder="开始时间"
            end-placeholder="结束时间" :clearable="false" 
           >
          </el-time-picker>
        </div>
        <div class="search_con">
          <el-button type="primary">昼伏夜出次数</el-button>
          <el-input v-model="form.daysAppeared2" @blur="searchingBtn" placeholder="≥"  @keyup.enter.native="searchingBtn"></el-input>
        </div>
        <div class="aside_bottom">
          <el-button  @click="searchingBtn()">
            <i class="el-icon-search"></i>
            搜索
          </el-button>
          <el-button class="export-btn"  @click="exportBtn()">
            <img  src="@/assets/images/investigateBusiness/export-btn.png"/>
            导出
          </el-button>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: "CustomM",
  props: {
  },
  data() {
    return {
      isDisabled:false,
      form: {
        daysAppeared: "",
        searchTime:[
          this.$moment(new Date()).subtract(1, "months").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().format("YYYY-MM-DD HH:mm:ss")
        ],
        daysAppeared2: '',
      },
    }
  },
  methods: {
    searchingBtn() {
      if(this.form.searchTime.length>0){
        let endTime=this.form.searchTime[1]
        let currentTime=this.$moment().format("YYYY-MM-DD HH:mm:ss")
        if(endTime.split(' ')[0]==currentTime.split(' ')[0]){
          this.form.searchTime=[
            this.$moment(new Date()).subtract(1, "months").format("YYYY-MM-DD HH:mm:ss"),
            this.$moment().format("YYYY-MM-DD HH:mm:ss")
          ]
        }
      }
      this.$emit('searchingBtn',this.form)
    },
    // 导出
    exportBtn(){

    },
  }
}
</script>

<style lang="scss" scoped>
.content-header {
  width: 100%;
}

.selectList {
  background: #141415;
  height: auto;
  padding-right: 30px;
  padding-top:30px;
  .el-form {
    display: flex;
    flex-wrap: wrap;
    height:37.5px;
    vertical-align: middle;
    padding-top:2.5px;
    .el-input {
      width: 150px;
      margin-right: 10px;
      margin-bottom: 5px;
    }

    .el-select {
      width: 150px;
      margin-bottom: 5px;
      margin-right: 10px;
    }

    .el-autocomplete {
      width: 150px;
      margin-bottom: 5px;
      margin-right: 10px;
    }
  }
}
::v-deep {
  .block{
   .time{
      margin-right: 10px; 
      background: #2c2c2d;
      height:35px;
    }
  }
  input{
    border: none;
  }
  .el-input__inner{
    border:none;
  }
  .search_con{
    height: 35px !important;
    display: flex;
    button{
      height: 35px !important;
      line-height: 6px;
      // border-top-right-radius: 0px;
      // border-bottom-right-radius: 0px;
    }
    input{
      border-top-left-radius: 0px;
      border-bottom-left-radius: 0px;
      border: none;
    }

  }
  
  .aside_bottom {
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    margin-right: 20px;
    margin-top:-2.5px;
    .el-button {
      border-radius: 60px;
      opacity: 1;
      color: #01c2ff;
      background: rgba(10, 26, 52, 0.6);
      border: 1px solid rgba(89, 175, 249, 0.7049);
      box-sizing: border-box;
      box-shadow: inset 0px 0px 5px 0.5px rgba(3, 251, 255, 0.6513);
    }
    .export-btn{
      color: #fff;
      img{
        width:10px;
        display:inline-block;
        line-height:30px;
        margin-right:5px;
      }
    }
  }
  .el-pagination.is-background .btn-next,
  .el-pagination.is-background .btn-prev,
  .el-pagination.is-background .el-pager li {
    background-color: #1f2935;
    color: #ffffff;
  }
  .el-breadcrumb__inner {
    color: #ccc !important;
  }


  .el-input {
    input {
      height: 35px !important;
    }

    .el-input__inner {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }
  }


  .el-scrollbar__view {
    background-color: #36596f;
  }

  .el-range-input {
    background: #2c2c2d;
    color: #fff;
  }
  .el-date-editor--datetimerange.el-input__inner {
    width: 220px;
  }
}
::v-deep .el-tag.el-tag--info {
  background-color: #5e6b79;
  border-color: #5e6b79;
  color: rgba(255, 255, 255, 0.9);
}
</style>
